-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add "StartBlock::Continue" to registry contract/types #548
feat: Add "StartBlock::Continue" to registry contract/types #548
Conversation
@@ -294,7 +294,7 @@ mod tests { | |||
) | |||
.unwrap(), | |||
function_name: "test".to_string(), | |||
indexer_rule: registry_types::IndexerRule { | |||
indexer_rule: registry_types::OldIndexerRule { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be migrated to new types in a future PR
@@ -274,7 +274,7 @@ mod tests { | |||
use mockall::predicate; | |||
use std::collections::HashMap; | |||
|
|||
use registry_types::{IndexerRule, IndexerRuleKind, MatchingRule, Status}; | |||
use registry_types::{IndexerRuleKind, MatchingRule, OldIndexerRule as IndexerRule, Status}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be migrated to new types in a future PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume we're going forward with Update, or some version of that instead of FromInterruption?
Otherwise it looks good to me!
Seems like the approach was to create new functions to avoid having to build in backwards compatibility and bloat existing code further, migrate our services over to new functions, and then return and clean up the old code?
RegistryV3, | ||
AccountV3(CryptoHash), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of these? I'm a bit confused how these are used in conjunction with various types like IndexersByAccount. Seems we use all of them in some way or another.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't completely understand, but afaik, we need to use a unique storage key for each collection we store. Re-using an existing key could lead us to read stale state and therefore fail deserialization. This is essentially a helper for creating unique keys.
In saying that, the migration actually ignores existing state so it's probably ok to ignore these, but I kept doing it just incase 😅
Yup, I'll rename to
Yes exactly, V2 will use the new functions, while V1 still uses the existing. I'll then remove the existing functions once V2 is live. |
642d7f1
to
9e92f71
Compare
11d61f6
to
cc7ad3e
Compare
This has been deployed to dev, will let it sit for a bit and then to prod |
The start block parameter (
start_block_height
) has two states, signifying "Start from block" and "Start from latest" only. With the removal of the continuous "real-time" process, which essentially runs Indexers "From Interruption", the need for a third state arises, representing "Interruption" arises. This PR expands the registry contract/types to accommodate this change. This work was a good opportunity to refactor the existing types, removing unnecessary fields and tailoring it to the new architecture.Registry Types Refactoring
filter: IndexerRule
->rule: Rule
:IndexerRule
contained a lot of noise/data which was not needed.id
,name
, andindexer_rule_kind
have all been removed. The only useful part here isMatchingRule
which has been renamed to justRule
.schema
is now non-optional: This field is always required so it makes sense to convey that in the code. Having it as anOption
created lots of unnecessary checks throughout the system.start_block_height
replaced bystart_block
: The latter being anenum
to represent "From Latest", "From Block", and "From Interruption"Public methods/API
To minimise the disruption of the existing contract consumers, the public API remains unchanged, i.e. the core methods (
list_indexer_functions
,register_indexer_function
, etc.) use/return the same types. As the underlying data will be migrated to the new types, these methods infer the old types from the new ones. New methods have been created to work with the new types (register
,list_all
, etc.) allowing clients to move over when possible, as opposed to creating a breaking change.